//服务层
app.service('inexService',function($http){
	    	
	//读取列表数据绑定到表单中
	this.findAll=function(){
		return $http.get('../inex/findAll.do');		
	}
	//分页 
	this.findPage=function(page,rows){
		return $http.get('../inex/findPage.do?page='+page+'&rows='+rows);
	}
	//查询实体
	this.findOne=function(id){
		return $http.get('../inex/findOne.do?id='+id);
	}
	//增加 
	this.add=function(entity){
		return  $http.post('../inex/add.do',entity );
	}
	//修改 
	this.update=function(entity){
		return  $http.post('../inex/update.do',entity );
	}
	//删除
	this.dele=function(ids){
		return $http.get('../inex/delete.do?ids='+ids);
	}
	//搜索
	this.search=function(page,rows,searchEntity){
		return $http.post('../inex/selectAll.do?page='+page+"&rows="+rows, searchEntity);
	}    	
	
	//搜索
	this.search03=function(page,rows){
		return $http.post('../inex/selectAll.do?page='+page+"&rows="+rows,searchEntity);
	}    
	
		//上传图片
	this.upload=function(){
		//创建表单对象
		var formData = new FormData();
		/*var file = document.querySelector('input[type=file]').files[0];*/
		var file = document.querySelector('input[id=imageShow]').files[0];
		//设置表单
		formData.append('file', file);
		return $http({
                method:"post",
                url:"/file/upload.do",
                data:formData,
                headers : {
                    'Content-Type' : undefined
                },
                transformRequest : angular.identity
           });
	}
	
});
